<style>

table thead th{ padding:10px; background:#eaeaea;}
table tbody td{ padding:10px; text-align:center;}

</style>
<h1>
	Grade Horária - 
	<?php echo 	$grade[2][0]['TurmaAnoLetivo']['Turma']['nm_turma']
				." - ".
				$grade[2][0]['TurmaAnoLetivo']['nu_ano_letivo']
				." (".$grade[2][0]['TurmaAnoLetivo']['periodo'].")"; 
	?>
</h1>
	<table class="table table-striped table-bordered table-condensed" width="100%" cellpadding="0" cellspacing="0" border="1">
        <thead>
          <tr>
            <th>Segunda-feira</th>
            <th>Terça-feira</th>
            <th>Quarta-feira</th>
            <th>Quinta-feira</th>
            <th>Sexta-feira</th>
          </tr>
        </thead>
        <tbody>
        
        <?php if(count($grade)== 5): ?>
        
         <?php for($i=0; $i<5; $i++):?>
         	<?php if($i == 2):?>
         		<tr>
         			<td colspan="5">
         				INTERVALO
         			</td>
         		</tr>
         	<?php else: ?>
	          <tr>
	          		<?php for($k=2; $k<7; $k++):?>
			            <td>
			            	<?php
			            		if(isset($grade[$k][$i]))
			            		{
				            		echo "<b>".Util::hour($grade[$k][$i]['nu_hora_inicio'])." - ". Util::hour($grade[$k][$i]['nu_hora_fim'])."</b><br />";
				            		echo $grade[$k][$i]['Disciplina']['nm_disciplina']."<br />";
				            		echo $grade[$k][$i]['Docente']['nm_docente']."<br />";
			            		}
			            	?>
			            </td>
		            <?php endfor;?>
	          </tr>
	         <?php endif; ?>
          <?php endfor; ?>
          
          <?php endif; ?>
        </tbody>
      </table>